﻿//
// key.hpp
// ~~~~~~~
//

#ifndef YUTOPP_OAUTH_CORE_KEY_V1_HPP
#define YUTOPP_OAUTH_CORE_KEY_V1_HPP

#include <string>

namespace webapp
{
	namespace oauth
	{
		namespace v1
		{
			//認証データ
			template<typename String>
			class basic_key
			{
				typedef String oauth_text;

			public:
				basic_key() {}

				basic_key( const oauth_text& consumer_key, const oauth_text& consumer_secret )
					: consumer_key_( consumer_key )
					, consumer_secret_( consumer_secret )
				{}

				basic_key( const oauth_text& consumer_key, const oauth_text& consumer_secret, const oauth_text& token, const oauth_text& secret )
					: consumer_key_( consumer_key )
					, consumer_secret_( consumer_secret )
					, token_( token )
					, secret_( secret )
				{}

				void set_consumer_key( const oauth_text& consumer_key )
				{
					consumer_key_ = consumer_key;
				}

				void set_consumer_secret( const oauth_text& consumer_secret )
				{
					consumer_secret_ = consumer_secret;
				}

				void set_token( const oauth_text& token )
				{
					token_ = token;
				}

				void set_secret( const oauth_text& secret )
				{
					secret_ = secret;
				}

				const oauth_text& get_consumer_key() const
				{
					return consumer_key_;
				}

				const oauth_text& get_consumer_secret() const
				{
					return consumer_secret_;
				}

				const oauth_text& get_token() const
				{
					return token_;
				}

				const oauth_text& get_secret() const
				{
					return secret_;
				}

				bool is_complete() const
				{
					return !( consumer_key_.empty() || consumer_secret_.empty() || token_.empty() || secret_.empty() );
				}

			private:
				oauth_text consumer_key_, consumer_secret_;
				oauth_text token_, secret_;
			};

			typedef basic_key<std::string> key;
		} // - v1
	} // - oauth
} // - webapp

#endif /*YUTOPP_OAUTH_CORE_KEY_V1_HPP*/
